using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using UnityEngine;

namespace Galplay
{
  public class ScriptPicture : GalScript {
    public int Slot { get; set; }
    public string Filename { get; set; }
    public Vector2Int Point { get; set; }
    public int Frame { get; set; }

    public ScriptPicture(GalScene owner, XmlNode node) : base(owner, node, ScriptType.Picture) {
      Slot = node.GetInt("Slot");
      Point = node.GetVector2Int("Pos");
      Frame = node.GetInt("Frame");
      Filename = Kit.AutoAddExtension(node.InnerText, ".png");
    }

    public override void Execute(GameScenePlayer player) {
      //GM.SetPicture(Slot, Filename);
      player.imageManager.SetPicture(Slot, Point, GetFileName());
    }

    private string GetFileName() {
      return Kit.AutoCombine(GM.Game.ImagePath, Filename);
    }
  }
}